package org.db2.project.airline.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import java.io.Serializable;


/**
 * The persistent class for the FLIGHT database table.
 */
@Entity
public class Flight implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(name = "FLIGHT_ID_GENERATOR", sequenceName = "FLIGHT_SEQ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "FLIGHT_ID_GENERATOR")
    private long id;

    //bi-directional many-to-one association to Airplane
    @ManyToOne
    @JoinColumn(name = "AIRPLANEID")
    private Airplane airplane;

    //bi-directional many-to-one association to FlightCrew
    @ManyToOne
    @JoinColumn(name = "CREWID")
    private FlightCrew flightCrew;

    public Flight() {
    }

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Airplane getAirplane() {
        return this.airplane;
    }

    public void setAirplane(Airplane airplane) {
        this.airplane = airplane;
    }

    public FlightCrew getFlightCrew() {
        return this.flightCrew;
    }

    public void setFlightCrew(FlightCrew flightCrew) {
        this.flightCrew = flightCrew;
    }
}